home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-06-22 | 1.7 KB | 65 lines | [TEXT/PJMM] |
- unit LogUtils;
-
- interface
-
- uses
- Globals;
-
- procedure TimeStamp;
-
- function Int2Char (Number: integer): char;
-
- implementation
-
- { ------------------------------------------------------ }
-
-
- function Int2Char;{ (Number: integer): char}
-
- { Function changes integer to character. }
-
- begin
- Int2Char := chr(Number + ord('0'));
- end;
-
- { ------------------------------------------------------ }
-
- function TwoDigit (Number: integer): string;
-
- { Function changes two-digit number to a two-character string. }
-
- begin
- TwoDigit := concat(Int2Char(Number div 10), Int2Char(Number mod 10));
- end;
-
- { ------------------------------------------------------ }
-
- procedure TimeStamp;
-
- var
- Today: DateTimeRec;
- ASCIIHour: string;
-
- begin
- GetTime(Today);
-
- { The TwoDigit function in the following section turns a two-digit integer }
- { into a two-character string. If there are fewer than two digits, the string }
- { contains a leading '0'. }
-
- with Today do
- begin
- ASCIIHour := TwoDigit(Hour); { This bit of nonsense is to get the Tabby Log output }
- if length(ASCIIHour) > 1 then { to match a Tabby convention: single-digit hours do }
- if (copy(ASCIIHour, 1, 1) = '0') then { not have leading zeroes, even though all other single }
- ASCIIHour := copy(ASCIIHour, 2, 1); { digit numbers do. }
-
- DateString := concat(TwoDigit(Month), '/', TwoDigit(Day), '/', TwoDigit(Year - 1900));
- TimeString := concat(ASCIIHour, ':', TwoDigit(Minute), ':', TwoDigit(Second));
- DateString := concat(DateString, ' ', TimeString);
- end;
- end;
-
- { ------------------------------------------------------ }
-
- end.